﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TemplateCreator
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            txtResult.Text = "";          
            for (int i = 0; i < txtRaw.Lines.Count();i++)
            {
                var result = "";
                if (i == 0)
                {
                    result = string.Format("string {0}=\"\";",  txtVar.Text);
                }
                var strChecked =  txtRaw.Lines[i].Replace("\"", "\\\"");


                result += string.Format("\r\n {0} +={1}{2}{3}{1}{4}", txtVar.Text,  "\"",txtNewLine.Text, strChecked, ";");                
                txtResult.AppendText(result);
 
            }
        }

        private void btnCopy_Click(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(txtResult.Text, true);
        }

        private void btnPaste_Click(object sender, EventArgs e)
        {
            txtRaw.Text = Clipboard.GetText();
        }

        private void btnRawClear_Click(object sender, EventArgs e)
        {
            txtRaw.Text = "";
        }

        private void btnResultClear_Click(object sender, EventArgs e)
        {
            txtResult.Text = "";

        }
    }
}
